
<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %> 
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri = "http://java.sun.com/jstl/core" prefix = "c"%>
<%@ page import="mb.commons.StaticElements"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%
	String contextPath = request.getContextPath();
%>
<%
	out.println(StaticElements.header("ELS - Find your way","style2.css"));
%>

</head>
<body>
	<div class=tabela >
<%
	String adres = "main";
	if (request.getParameter("add") != null) {
		adres = request.getParameter("add");
	}
	String lang = null;
	if (session.getAttribute("lang") != null)
		lang = session.getAttribute("lang").toString();
	else {
		session.setAttribute("lang", "pl");
		lang = "pl";
	}
	if (session.getAttribute("log") != null) {
		if(session.getAttribute("lang").equals("en")){
			if (session.getAttribute("log").equals("klient")) {out.println(StaticElements.naglowek("images/logo_eng2.png", 2,session.getAttribute("nick").toString(), adres,lang));
			} else if (session.getAttribute("log").equals("admin")) {
				out.println(StaticElements.naglowek("images/logo_eng2.png", 5,session.getAttribute("nick").toString(), adres,lang));
			} else if (session.getAttribute("log").equals("pracownik")) {
				out.println(StaticElements.naglowek("images/logo_eng2.png", 5,session.getAttribute("nick").toString(), adres,lang));
			} else if (session.getAttribute("log").equals("kurier")) {
				out.println(StaticElements.naglowek("images/logo_eng2.png", 5,session.getAttribute("nick").toString(), adres,lang));
			} else if (session.getAttribute("log").equals("blad")) {out.println(StaticElements.naglowek("images/logo_eng2.png", 3,"Login error, incorrect data.", adres, lang));session.setAttribute("log", "zero");
			} else if (session.getAttribute("log").equals("nie")) {out.println(StaticElements.naglowek("images/logo_eng2.png", 4, "You have been successfully logged out.", adres,lang));
				session.setAttribute("log", "zero");
			} else if (session.getAttribute("log").equals("zero")) {out.println(StaticElements.naglowek("images/logo_eng2.png", 1, null, adres, lang));
			} else if (session.getAttribute("log").equals("")) {out.println(StaticElements.naglowek("images/logo_eng2.png", 1, null, adres, lang));
			}	
		}else{
			if (session.getAttribute("log").equals("klient")) {out.println(StaticElements.naglowek("images/logo_eng2.png", 2,session.getAttribute("nick").toString(), adres,lang));
			} else if (session.getAttribute("log").equals("admin")) {
				out.println(StaticElements.naglowek("images/logo_eng2.png", 5,session.getAttribute("nick").toString(), adres,lang));
			} else if (session.getAttribute("log").equals("pracownik")) {
				out.println(StaticElements.naglowek("images/logo_eng2.png", 5,session.getAttribute("nick").toString(), adres,lang));
			} else if (session.getAttribute("log").equals("kurier")) {
				out.println(StaticElements.naglowek("images/logo_eng2.png", 5,session.getAttribute("nick").toString(), adres,lang));
			} else if (session.getAttribute("log").equals("blad")) {out.println(StaticElements.naglowek("images/logo_eng2.png", 3,"Bład logowania, dane są niepoprawne.", adres, lang));session.setAttribute("log", "zero");
			} else if (session.getAttribute("log").equals("nie")) {out.println(StaticElements.naglowek("images/logo_eng2.png", 4, "Zostałes wylogowany.", adres,lang));
				session.setAttribute("log", "zero");
			} else if (session.getAttribute("log").equals("zero")) {out.println(StaticElements.naglowek("images/logo_eng2.png", 1, null, adres, lang));
			} else if (session.getAttribute("log").equals("")) {out.println(StaticElements.naglowek("images/logo_eng2.png", 1, null, adres, lang));
			}			
		}
	} else {session.setAttribute("log", ""); out.println(StaticElements.naglowek("images/logo_eng2.png",1, null, adres, lang));
	}
%>

<div class='menu'>
<% 	if(session.getAttribute("lang")!=null && session.getAttribute("lang").equals("pl")){
			out.println(StaticElements.menuglowne("pl"));
		}
		else{
			out.println(StaticElements.menuglowne("en"));
		}
%>
</div>

<div class='content' id='content'>
		<div class='pleft' id='pleft'>
		<%@ include  file='pleft.jsp'%>
		</div>		
		<div class='tresc' id='tresc'>
		<%String add= request.getParameter("add");  %>  
		<jsp:useBean id="sessionBean" scope="session" class="mb.commons.SessionBean" />   
 		<jsp:setProperty name="sessionBean" property="add" value='<%=request.getParameter("add") %>' />
		<%  if(request.getParameter("add")!=null){
			try{
				RequestDispatcher rd ;
					if(request.getParameter("add").equals("forgot") && request.getParameter("state")!=null && request.getParameter("state").equals("change")){
		%>
		<% System.out.println(request.getParameter("add")); %>

		<f:view>
			<script type="text/javascript">
			jQuery.noConflict();
			</script>
		<center>	
		<jsp:include page="${sessionBean.add}.jsp" ></jsp:include>
		</center>
		</f:view>
		<%					
					}else{
						session.setAttribute("login","");
		%>
		<f:view>
			<script type="text/javascript">
			 jQuery.noConflict();
			</script>
			<center>
			<jsp:include page="${sessionBean.add}.jsp"></jsp:include>
			</center>		
		</f:view>
		<% 				
					}				
				}
				catch(Exception ex){
				%>
				<jsp:include page="error.jsp"></jsp:include>
				<% 
				}
		}
		else{
			%>
			<jsp:include page="main.jsp"></jsp:include>
			<% 
		}
		%>
		</div>
	</div>	
	<div class='stopka'>
	<%@ include  file='stopka.jsp'%>
	</div>
</div>
</body>
</html>